<table width="100%"  border="0" cellPadding=0 cellSpacing=0>
 <tr><td colspan="3" bgcolor="#333333" ></td></tr>
  <tr>
    <td width="75%" style="padding-left:10px " valign="top">
<?php
	//$url=$_SERVER['PHP_SELF']; 
	$url=$_SERVER['HTTP_HOST'].$_SERVER['QUERY_STRING']; 
	if (eregi("products.php",$url)) {	
		die("&nbsp;");
	}
	//check_gpc();
	
	$template_mem_body="template/Customerprofile.tpl";
	
	$base_url 	= 'supplier.php';
	$mode=isset($_GET["mode"]) ? htmlspecialchars($_GET["mode"]) : '';
	
	switch($mode){ 
		case "productDetail":
			productDetail();
			break;
		default:
			memberInfo(); 
			break;
	}
function memberInfo(){
	global $template, $db, $template_mem_body,$cid,$site_base_href,$ids;
	
	//Profile company vb_companyprofile, vb_memberprofile - Thông tin chi tiet ve cong ty
	$sql="select  m.memID, m.FirstName, m.LastName, m.CompanyName, m.Sex, 
			m.AlternativeEmail,m. BusinessType, m.IndustryCategory, m.NumberEmployees, m.Address, m.City, 
			m.State, m.Zip, m.Web, m.JobTitle, m.contrycode, m.areacode, m.BusinessPhone, m.faxcontrycode, 
			m.faxareacode, m.FaxNumber, m.Mobile, m.fName, m.countryID, m.orthJob, m.lName, 
			m.CompanyName_vn, m.Address_vn, m.fName_vn,  m.lName_vn, m.FirstName_vn, m.LastName_vn, m.City_vn,
			m.State_vn, m.orthJob_vn, m.lastEdit,  m.lastEdit_vn, m.id,c.*,
			mem.* from vb_member mem inner join vb_companyprofile c on mem.memID=c.memID  inner join vb_memberprofile m 
			on c.memID=m.memID where mem.memID=".$cid;
	if(!$result=$db->sql_query($sql)){
		message_die("Couldn't run the sql query!!!","",__LINE__,__FILE__,$sql);
	}	
	$mem_data=$db->sql_fetchrow($result);
	
	$memName=$mem_data["fName"] ."&nbsp;". $mem_data["lName"];
	$jobtitle=!empty($mem_data["orthJob"]) ? $mem_data["orthJob"] : getJobTitle($mem_data["JobTitle"]);
	$template->assign_vars(array(			
		'maintitle'	=> $mem_data["CompanyName"] . ' -  yellowpages.vn | Vietnam - ',
		'logo'		=>	!empty($mem_data["barner"]) ? "<img src=\"barner/".$mem_data["barner"]."\" align=\"absmiddle\">" : '' ,
		'companyName'	=>  $mem_data["CompanyName"],		
		'address'	=>$mem_data["Address"],
		'city'		=>$mem_data["City"].", ".getContry($mem_data["countryID"]),
		'telephome' => number_format($mem_data["contrycode"]) ."-".number_format($mem_data["areacode"])."-".$mem_data["BusinessPhone"],
		'divtel' 	=>!empty($mem_data["BusinessPhone"]) ? 'bock' : 'none',
		'fax'		=> number_format($mem_data["faxcontrycode"]) ."-".number_format($mem_data["faxareacode"])."-".$mem_data["FaxNumber"],
		'divfax' 		=>!empty($mem_data["FaxNumber"]) ? 'bock' : 'none',
		'contact'		=>$site_base_href.'/index.php?ids='.$ids.'&lang=us&/Enquiry/contact/'.$cid,
		'email'			=>'<a href="mailto:'.$mem_data["AlternativeEmail"].'" target="_blank" class="ca">'.$mem_data["AlternativeEmail"].'<a>',
		'divcontactEmail'	=>!empty($mem_data["AlternativeEmail"]) ? 'bock' : 'none',				
		'web'				=>'<a href="http://'.$mem_data["Web"].'" target="_blank" class="ca">'.$mem_data["Web"].'</a>',	
		'divcontactWeb'		=>!empty($mem_data["Web"]) ? 'bock' : 'none',		
		'companyExecutive'	=> ($mem_data["Sex"]=="Male" ? "Mr. " : "Ms. ") . $memName,		 
		'divcontactName' 	=>strlen($memName)>9 ? 'bock' : 'none',
		'divjobtitle' 		=> (strlen($memName)>9&& strlen($jobtitle)>2) ? 'bock' : 'none',
		'description'		=>html_entity_decode(nl2br($mem_data["CompanyIntroduction"])),
		'div_desc'			=>!empty($mem_data["CompanyIntroduction"]) ? 'bock' : 'none',
		'productsService'	=>html_entity_decode(nl2br($mem_data["ProdSer_en"])),		
		'div_proServ'		=>!empty($mem_data["ProdSer_en"]) ? 'bock' : 'none',		
		'workinghour'		=>html_entity_decode(nl2br($mem_data["workinghours_en"])),		
		'div_workHour'		=>!empty($mem_data["workinghours_en"]) ? 'bock' : 'none',		
		'brandname'			=>showtrade($mem_data["brankName_en"]),		
		'div_brandName'		=>!empty($mem_data["brankName_en"]) ? 'bock' : 'none',		
		'ortherInfomation'	=>html_entity_decode(nl2br($mem_data["ortherInfomationEn"])),		
		'div_Contact'		=>!empty($mem_data["ortherInfomationEn"]) ? 'bock' : 'none',		
		'numberEmployees'	=>getNumEmployee($mem_data["NumberEmployees"]),			
		'div_numem'			=>!empty($mem_data["NumberEmployees"]) ? 'bock' : 'none',		
		'ceo'				=>$mem_data["Legal"],
		'div_ceo'			=>!empty($mem_data["Legal"]) ? 'bock' : 'none',
		'yearEstablished'	=>$mem_data["YearEstablished"],
		'div_yearEst'	=>!empty($mem_data["YearEstablished"]) ? 'bock' : 'none',
		'certification'	=>$jobtitle,		 
		'divcerti'		=>!empty($jobtitle) ? 'bock' : 'none',			
	));
	
	$template->set_filenames(array("body"	=> $template_mem_body));
	$template->pparse('body');
} 
function showtrade($cat=''){
	global $template, $db;	
	
	$where='';
	if(empty($cat)){
		return;
	}
	$arr1=explode(",",$cat);
	$c1=sizeof($arr1)-1;
	
	for($i=0;$i<$c1;$i++){
		if(!empty($arr1[$i])){
			$where.=!empty($where) ? ','.$arr1[$i] : $arr1[$i];
		}
	}
	
	$sql="select * from vb_trade where id in (".$where.")";   
	
	if(!$result=$db->sql_query($sql)){
		message_die("Couldn't run the sql query!!!","",__LINE__,__FILE__,$sql);
	}
	$catCaption='';
	$cat_count=$db->sql_numrows($result);
	$cat_data=$db->sql_fetchrowset($result);
		 
	for($j=0;$j<$cat_count;$j++){	 
		$catCaption.= !empty($catCaption) ? ', '. $cat_data[$j]['c_name'] : $cat_data[$j]['c_name'];	 
	}
	return $catCaption;
}
?></td>
<td  bgcolor="#333333"></td>
    <td width="25%" valign="top" style="padding-top:10px " ><table width="200" border="0">
      <tr>
        <td style="padding-left:10px "><strong>Categories</strong></td>
      </tr>
      <tr>
        <td style="padding-left:10px ">

		<? include "uproducts.php"?></td>
      </tr>
    </table></td>
  </tr>
</table>
